import request from '@/utils/request'

// api地址
const api = {
  order: 'checkout/order',
  submit: 'checkout/submit',
  bank: 'order/storeBank',
  position: 'checkout/deliveryArea',
  positionCart: 'checkout/deliveryAreaCart'
}

// mode: 结算模式 (buyNow立即购买 cart购物车)

// 结算台订单信息
export const order = (mode, param) => {
  return request.get(api.order, { mode, ...param })
}

// 结算台订单提交
export const submit = (mode, data) => {
  return request.post(api.submit, { mode, ...data })
}

// 获取线下支付信息
export const getBank = (data) => {
  return request.post(api.bank, { ...data })
}

// 检查是否属于配送范围
export const checkPosition = (data) => {
  return request.post(data.cartIds ? api.positionCart : api.position, { ...data })
}
